package com.devframe.srtp.server.parse;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.jboss.netty.handler.codec.http.multipart.FileUpload;

import com.devframe.srtp.SRTPConstants;

public class SRTPParam {

	/**
	 * 请求动作
	 */
	private String action;
	/**
	 * 上传用户
	 */
	private String userName;
	
	/**
	 * 密码
	 */
	private String pwd;
	
	/**
	 * 其他参数
	 */
	private Map<String,String> otherParams=new HashMap<String,String>();

	/**
	 * 缩略图标记，在上传图片时如果需要生产缩略图时，加上该参数,默认不需要进行传输
	 */
	private String thumbMark=SRTPConstants.THUMB_MARK_NO;
	/**
	 * 上传文件
	 */
	private FileUpload fileUpload;
	/**
	 * 文件路径
	 */
	private String filePath;
	/**
	 * 文件名
	 */
	private String fileName;
	/**
	 * 文件类型
	 */
	private String fileContentType;
	
 
	public String getAction() {
		return action;
	}
	public void setAction(String action) {
		this.action = action;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	public Map<String, String> getOtherParams() {
		return otherParams;
	}
	public FileUpload getFileUpload() {
		return fileUpload;
	}
	public void setFileUpload(FileUpload fileUpload) {
		this.fileUpload = fileUpload;
	}
	public String getThumbMark() {
		return thumbMark;
	}
	public void setThumbMark(String thumbMark) {
		this.thumbMark = thumbMark;
	}
	
	public void putOtherParam(String key,String value){
		this.otherParams.put(key, value);
	}
	
	
 
	public String toString() {
		StringBuffer sb=new StringBuffer();
		sb.append("詹保山测试NETTY WEB Server\r\n");
		sb.append("===================================\r\n");
		sb.append("\r\n\r\n");
		if(StringUtils.isNotBlank(this.getUserName())){
			sb.append("UserName="+this.getUserName()+"\r\n");
		}
		if(StringUtils.isNotBlank(this.getPwd())){
			sb.append("pwd="+this.getPwd()+"\r\n");
		}
		if(StringUtils.isNotBlank(this.getAction())){
			sb.append("action="+this.getAction()+"\r\n");
		}
		if(StringUtils.isNotBlank(this.fileName)){
			sb.append("fileName="+this.getFileName()+"\r\n");
		}
		if(StringUtils.isNotBlank(this.fileContentType)){
			sb.append("fileContentType="+this.getFileContentType()+"\r\n");
		}
		if(this.otherParams!=null){
			for(Map.Entry<String, String> item:this.otherParams.entrySet()){
				sb.append(item.getKey()+"="+item.getValue()+"\r\n");
			}
		}
		return sb.toString();
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public String getFileContentType() {
		return fileContentType;
	}
	public void setFileContentType(String fileContentType) {
		this.fileContentType = fileContentType;
	}
	public String getFilePath() {
		return filePath;
	}
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	
}
